<?php

class updateUserInfoAction extends sfAction
{
    public function execute($request)
    {
        $fb_user = $this->getUser()->getFbUser();
        if (!$fb_user) {
            $this->renderText(json_encode(array(
                        'status' => 'no_user',
                        )));
        } else {
            $fb_user->updateInfo();
            $fb_user->save();

            $this->renderText(json_encode(array(
                'status' => ($fb_user->email ? 'success' : 'missing_email'),
                'perms'  => 'email',
                )));
        }
        return sfView::NONE;
    }
}
